﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DAL;
using BLL;

namespace _3tiers
{
    public partial class tab3_Form_ThemSV : Form
    {
        public tab3_Form_ThemSV()
        {
            InitializeComponent();
        }

        private void btXoaLop_Click(object sender, EventArgs e)
        {

        }

        private void btReset_Click(object sender, EventArgs e)
        {            
            tbHoTen.Text = "";            
            tbNgaySinh.Text = "";
            tbSDT.Text = "";
            tbEmail.Text = "";
        }
        DataAccess ac = new DataAccess();
        BLL.BLL business = new BLL.BLL();
        private void btThemSV_Click(object sender, EventArgs e)
        {
            try
            {
                string idKhoa = cbbKhoa.SelectedValue.ToString();
                string idLop = cbbLop.SelectedValue.ToString();
                string sql = "insert into tblSinhVien values('c','" + idLop + "','" + idKhoa + "','" + tbHoTen.Text + "','" + tbNgaySinh.Text + "','" + tbSDT.Text + "','" + tbEmail.Text + "')";
                business.Insert(sql);
                lbThongBao.Text = "Thêm sinh viên thành công.";
            }
            catch { lbThongBao.Text = "Thêm sinh viên thất bại"; }
        }

        private void tab3_Form_ThemSV_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'khoaDataSet.tblKhoa' table. You can move, or remove it, as needed.
            this.tblKhoaTableAdapter.Fill(this.khoaDataSet.tblKhoa);
            // TODO: This line of code loads data into the 'quanLyLichDayDataSet16.tblLop' table. You can move, or remove it, as needed.
            this.tblLopTableAdapter.Fill(this.quanLyLichDayDataSet16.tblLop);

        }

        private void btThemLop_Click(object sender, EventArgs e)
        {
            tab3_Form_ThemLop dt = new tab3_Form_ThemLop();
            dt.Show();
        }

        private void btSuaLop_Click(object sender, EventArgs e)
        {
            tab3_Form_SuaLop dt = new tab3_Form_SuaLop();
            dt.Show();
        }
    }
}
